package com.example.a2207_zh.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.a2207_zh.R
import com.example.a2207_zh.adapter.ViewPageAdapter
import com.example.a2207_zh.databinding.FragmentHomeBinding
import com.example.a2207_zh.mvvm.BaseViewFragment


//首页嵌套---视频、商品

class HomeFragment : BaseViewFragment<FragmentHomeBinding>() {
    val list = mutableListOf<Fragment>()
    val titles = mutableListOf<String>()

    lateinit var viewPageAdapter: ViewPageAdapter

    override fun getLayout(): Int  = R.layout.fragment_home

    override fun initView() {
        list.add(VideoFragment())
        list.add(ShopFragment())
        titles.add("视频")
        titles.add("商城")

        viewPageAdapter = ViewPageAdapter(childFragmentManager,list,titles)
        binding.vp.adapter = viewPageAdapter
        binding.tab.setupWithViewPager(binding.vp)
    }

    override fun initData() {

    }


}